<div>
<button id="button-today" class="btn btn-primary">今天</button>
<button id="button-yesterday" class="btn btn-primary">昨天</button>
<button id="button-7days" class="btn btn-primary">7天</button>
<button id="button-month" class="btn btn-primary">30天</button>
从
<input type="text" id="text-date-begin"/> -
<input type="text" id="text-date-end"/>
<button id="button-search" class="btn btn-primary">查找</button>
</div>

<div style="margin-left:20px">
    <table id="jqGrid"></table>
    <div id="jqGridPager"></div>
</div>
<script type="text/javascript">
    var makeSearchParam = function(searchType){
        var param = {};
        var todaystr = DateTime.getDayStr();
        switch(searchType){
            case 'today':
                param = {begindate:todaystr, enddate:todaystr};
            break;
            case 'yesterday':
                var ys = DateTime.getDayStr(DateTime.getDayOffset(new Date(), -1));
                param = {begindate:ys, enddate:ys};
            break;
            case '7days':
                ys = DateTime.getDayStr(DateTime.getDayOffset(new Date(),-7));
                param = {begindate:ys, enddate:todaystr};
            break;
            case 'month':
                ys = DateTime.getDayStr(DateTime.getDayOffset(new Date(),-30));
                param = {begindate:ys, enddate:todaystr};
            break;
            case 'search':
                param = {begindate:$('#text-date-begin').val(), enddate:$('#text-date-end').val()};
            break;
            
        }
        if(searchType != 'search'){
            $('#text-date-begin').val(param.begindate);
            $('#text-date-end').val(param.enddate);
        }
        return param;
    };
</script>